﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for PLPersonnelDB
/// </summary>
/// 
namespace CE.PersonalLoan
{
    public class PLPersonnelDB
    {
        public PLPersonnelDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(PLPersonnel plpersonnel)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocPLApplicantPersonnelInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            _sPara.Add("@PLPersonnelId", plpersonnel.PLPersonnelId);
            _sPara.Add("@PLId", plpersonnel.PLId);
            _sPara.Add("@PLSalutation", plpersonnel.PLSalutation);
            _sPara.Add("@PLFirstName", plpersonnel.PLFirstName);
            _sPara.Add("@PLSurName", plpersonnel.PLSurName);
            _sPara.Add("@PLNameOfAppear", plpersonnel.PLNameOfAppear);
            _sPara.Add("@PLNationality", plpersonnel.PLNationality);
            _sPara.Add("@PLIdType", plpersonnel.PLIdType);
            _sPara.Add("@PLIdNo", plpersonnel.PLIdNo);
            _sPara.Add("@PLDOB", plpersonnel.PLDOB);
            _sPara.Add("@PLGender", plpersonnel.PLGender);
            _sPara.Add("@PLMaritalStatus", plpersonnel.PLMaritalStatus);
            _sPara.Add("@PLNoOfDependents", plpersonnel.PLNoOfDepent);
            _sPara.Add("@PLHighestEdu", plpersonnel.PLHighEdu);
            _sPara.Add("@PLEmail", plpersonnel.PLEmail);
            _sPara.Add("@PLMobilePhoneNo", plpersonnel.PLMobileNo);
            _sPara.Add("@PLHomePhoneNo", plpersonnel.PLHomePhone);
            _sPara.Add("@PLOfficePhoneNo", plpersonnel.PLOfficePhone);
            _sPara.Add("@PLUnitNo", plpersonnel.PLUnitNo);
            _sPara.Add("@PLHomeNo", plpersonnel.PLHomeNo);
            _sPara.Add("@PLStreetName", plpersonnel.PLStreetName);
            _sPara.Add("@PLCountry", plpersonnel.PLCountry);
            _sPara.Add("@PLPostalCode", plpersonnel.PLPostalCode);
            _sPara.Add("@PLYearsThere", plpersonnel.PLYearsofThere);
            _sPara.Add("@PLEmergencyNo", plpersonnel.PLEmergencyNo);
            _sPara.Add("@PLEContactRelation", plpersonnel.PLRelation);
            _sPara.Add("@PLMailing", plpersonnel.PLMailing == true ? 1 : 0);
            _sPara.Add("@PLSupplementary", plpersonnel.PLSupplementary == true ? 1 : 0);
            _sPara.Add("@RefCEUserId",plpersonnel.RefCEUserId);
            _sPara.Add("@ViewedDetailId", plpersonnel.ViewedDetailId);
            _sPara.Add("@Status", plpersonnel.PLStatus == true ? 1 : 0);

            _sPara.Add("@Info1", plpersonnel.PLInfo1);
            _sPara.Add("@Info2", plpersonnel.PLInfo2);
            _sPara.Add("@Info3", plpersonnel.PLInfo3);
            _sPara.Add("@Info4", plpersonnel.PLInfo4);
            _sPara.Add("@Info5", plpersonnel.PLInfo5);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }


    }
}
